﻿using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Volo.Abp.DependencyInjection;

namespace Xms.Abp.BackgroundJob;

public abstract class BackgroundJob<TArgs> : IBackgroundJob<TArgs>, ITransientDependency
{
    //TODO: Add UOW, Localization and other useful properties..?

    public ILogger<BackgroundJob<TArgs>> Logger { get; set; }

    protected BackgroundJob()
    {
        Logger = NullLogger<BackgroundJob<TArgs>>.Instance;
    }

    public abstract Task ExecuteAsync(TArgs args, CancellationToken cancellationToken = default);
}
